package xxhci.oracle.apps.XXIERP.TrainingEvoluation.server;

import oracle.apps.fnd.common.MessageToken;

import oracle.apps.fnd.framework.OAException;

import oracle.jbo.Row;

import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;

import oracle.jbo.Transaction;

import xxhci.oracle.apps.XXIERP.SalaryAdvance.server.EmpVOImpl;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class xxierptrainingevalAMImpl extends OAApplicationModuleImpl {
    /**This is the default constructor (do not remove)
     */
    public xxierptrainingevalAMImpl() {
    }

    public void createEvoluationMethod() {
    
    

        // xxierptrainingevalVOImpl eVO= (xxierptrainingevalVOImpl)getxxierptrainingevalVO1();
        // eVO.setWhereClause("STATUS= '" + Status + "'");
        OAViewObject vo = (OAViewObject)getxxierptrainingevalVO1();
        // Per the coding standards, this is the proper way to initialize a
        // VO that is used for both inserts and queries. See View Objects
        // in Detail in the Developer's Guide for additional information.
        if (!vo.isPreparedForExecution()) {
            vo.executeQuery();
        }
        Row row = vo.createRow();
        vo.insertRow(row);
        // Required per OA Framework Model Coding Standard M69
        row.setNewRowState(Row.STATUS_INITIALIZED);

    }

//    public void getEmpDetails(String l_username) {
//
//        try {
//
//            xxierptrainingevalEmpDetVOImpl sVO = 
//                (xxierptrainingevalEmpDetVOImpl)getxxierptrainingevalEmpDetVO1();
//
//            sVO.setWhereClause("USER_NAME= '" + l_username + "'");
//            System.out.println("getEmpDetails" + l_username);
//            sVO.executeQuery();
//
//
//        } catch (Exception ex) {
//            throw OAException.wrapperException(ex);
//        }
//    }


 public void getEmpDetails(String l_username, String l_Date) {
      // OAViewObject empVO = (OAViewObject)getEmpVO1();
      xxierptrainingevalEmpDetVOImpl empVO = 
                      (xxierptrainingevalEmpDetVOImpl)getxxierptrainingevalEmpDetVO1();
     if (empVO == null) {
         MessageToken[] errTokens = 
         { new MessageToken("OBJECT_NAME", "xxierptrainingevalEmpDetVO1") };
         throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
     }
     System.out.println(l_username);
     System.out.println(l_Date);
     empVO.setWhereClause("User_Name= '" + l_username + "'" + 
                          " AND TO_DATE('" + l_Date + 
                          "','YYYY-MM-DD') BETWEEN PAP_EFFECTIVE_START_DATE AND PAP_EFFECTIVE_END_DATE\n" + 
                          "   AND  TO_DATE('" + l_Date + 
                          "','YYYY-MM-DD') BETWEEN ASG_EFFECTIVE_START_DATE AND ASG_EFFECTIVE_END_DATE");
     empVO.executeQuery();
     System.out.println(l_username);
 }

    public void apply() {

        getTransaction().commit();

    }
    public void UpdateMethod(String pReqId) {
    try{
       
        xxierptrainingevalVOImpl pervo=getxxierptrainingevalVO1();
        String existingWhereClause = pervo.getWhereClause();
        pervo.setWhereClauseParams(null);
        pervo.setWhereClause("trng_eval_req_no = :1");
        pervo.setWhereClauseParam(0,pReqId);
        pervo.executeQuery();
        pervo.setWhereClauseParams(null);
        pervo.setWhereClause(existingWhereClause);
    }
    catch(Exception ex)
    {
        throw OAException.wrapperException(ex);
    }
    }
    public void rollbackEmployee()
     {
    Transaction txn = getTransaction();
     // This small optimization ensures that we don't perform a rollback
     // if we don't have to.
    if (txn.isDirty())
     {
     txn.rollback();
     }
     }
    
    /**Sample main for debugging Business Components code using the tester.
     */
    public static void main(String[] args) { /* package name */
            /* Configuration Name */launchTester("xxhci.oracle.apps.XXIERP.TrainingEvoluation.server", 
                                                 "xxierptrainingevalAMLocal");
    }


    /**Container's getter for xxierptrainingevalStatusVO1
     */
    public xxierptrainingevalStatusVOImpl getxxierptrainingevalStatusVO1() {
        return (xxierptrainingevalStatusVOImpl)findViewObject("xxierptrainingevalStatusVO1");
    }

    /**Container's getter for xxierptrainingevalEmpDetVO1
     */
    public xxierptrainingevalEmpDetVOImpl getxxierptrainingevalEmpDetVO1() {
        return (xxierptrainingevalEmpDetVOImpl)findViewObject("xxierptrainingevalEmpDetVO1");
    }

    /**Container's getter for xxierptrainingevalVO1
     */
    public xxierptrainingevalVOImpl getxxierptrainingevalVO1() {
        return (xxierptrainingevalVOImpl)findViewObject("xxierptrainingevalVO1");
    }
}
